﻿using Management.Systeam.Domaina;
using Management.Systeam.ErrorCode;
using Management.Systeam.Read.Apis.Application.Command.DepartMentes;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Management.Systeam.Read.Apis.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DepartMentAllController : ControllerBase
    {
        IMediator mediator;

        public DepartMentAllController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpPost]
        public async Task<ApiResult<int>> AddDepartMentes(AddDepartMentesCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpDelete]
        public async Task<ApiResult<int>> DelDepartMent([FromQuery] DelDepartMentCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public async Task<ApiResult<List<DepartMents>>> ShowDepartMent([FromQuery] ShowDepartMentCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpPut]
        public async Task<ApiResult<int>> UpdateDepartMent(UpdateDepartMentCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public async Task<ApiResult<int>> DelDepartMentAll([FromQuery] DelDepartMentAllCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
